#include <Python.h>
#include <pthread.h>
#include <assert.h>
#include <cxcore.h>
#include <cv.h>
#include <highgui.h>
#include "klt.h"
#include "egdebug.h"
#include "egluesh.h"

static PyObject* eglue_error;

/** wrap function to egGlueImage.
 */
static PyObject *py_egGlueImage(PyObject *self, PyObject *args) {
  EG_ENTERING;
  char *leftimage = NULL;
  char *rightimage = NULL;
  char *dstimage = NULL;
  if (!PyArg_ParseTuple(args, "sss", &leftimage, &rightimage, &dstimage)) {
     EG_EXITING;
     return NULL;
  }

  EG_DEBUGF("egGlueImage(%s,%s,%s)\n",timeout);
  egGlueImage((const char*) leftimage,(const char*) rightimage,(const char*) dstimage);
  EG_EXITING;
//  PyErr_SetString(eglue_error, "Event not received.");
  return PyString_FromString("egGlueImage");
}

/* list methods to be exported to eglue python module
 *
 */
static struct PyMethodDef eglue_methods[] = { { "eglue",
		py_egGlueImage, METH_VARARGS }, { NULL, NULL } };

/* module entry-point (module-initialization) function */
PyMODINIT_FUNC initeglue(void) {
   /* Create the module and add the functions */
   PyObject *m = Py_InitModule3("eglue", eglue_methods,
         "Interface for e-glue plugin.");
   eglue_error = PyErr_NewException((char*) "eglue.Exception", NULL, NULL);
}
